package com.zyq.validation.pojo.entity;

import com.zyq.validation.annotation.CannotBlank;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.*;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User1 {
    @NotNull(message = "用户名不能为null") //SpringValidation框架提供的检测注解
    @NotBlank(message="名字不能为空") //SpringValidation框架提供的检测注解
    @CannotBlank(message = "名字不能包含空格")
    @Size(min=2,max=5,message = "名字字符过多(2到5个字符)") //SpringValidation框架提供的检测注解
    private String  userName;


    //@Min(value = 0, message = "年龄不能小于0") //SpringValidation框架提供的检测注解
    //@Max(value = 240,message = "年龄不能大于240") //SpringValidation框架提供的检测注解
    //@AgeBetween(message = "年龄必须在[1到240]之间")
    private int age;
}